
$(function () {
    var url = window.location.href;
    var urlZ = url.split("|");
    var _loginName = GetRequest().loginName;
    var _token = urlZ[1];
    _loginName == undefined ? $(".userName").html("未登录") : $(".userName").html("管理员:" + _loginName)

    //获取用户loginName
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }


    //头像显示隐藏与登录
    function adminHeader() {
        if ($(".userName").text() == "未登录") {
            $(".userc").click(function () {
                location.href = "Login.html"
            });

        }
        else {
            $(".userc").click(function () {
                $(".usercard").fadeToggle()

            });
        }
    }

    adminHeader()
    //....头像显示隐藏与登录


    //  管理员注销按钮
    $("#signOut").click(function () {
        location.href = "Login.html"
    });

    // 左侧导航添加内嵌页面
    //添加管理员页面
    $("#adminPage").click(
        function () {
            $(".centerTable iframe").attr({"src": "RoleList.html?loginName=" + _loginName + "&token=|" + _token + "|"});
            barClo("#adminPage li", "img/admin.png")
        });
    //添加首页
    $("#homePage").click(
        function () {
            $(".centerTable iframe").attr({"src": "RoleList.html"});
            barClo("#homePage li", "img/home.png")
        });
    //权限页面
    $("#adminPowerPage").click(
        function () {
            $(".centerTable iframe").attr({"src": "PermissionsList.html?loginName=" + _loginName + "&token=|" + _token + "|"});
            barClo("#adminPowerPage li", "img/adminPower.png")
        });
    //注册用户管理
    $("#registeredUser").click(
        function () {
            $(".centerTable iframe").attr({"src": "UserList.html?loginName=" + _loginName + "&token=|" + _token + "|"});
            barClo("#registeredUser li", "img/registeredUser.png")
        });
    //策略 持仓 调仓
    $("#strategy").click(
        function () {
            $(".centerTable iframe").attr({"src": "StrategyManagement.html?loginName=" + _loginName + "&token=|" + _token + "|"});
            barClo("#strategy li", "img/strategy.png")
        });
//关键词
    $("#SendKeyManagement").click(
        function () {
            $(".centerTable iframe").attr({"src": "article-keyword-list.html?loginName=" + _loginName + "&token=|" + _token + "|"});
            barClo("#SendKeyManagement li", "img/keyWord.png")
        });

});